// config/db.config.js
const mysql = require('mysql2');

const pool = mysql.createPool({
    host: process.env.DB_HOST || 'localhost',
    user: process.env.DB_USER || 'root',
    password: process.env.DB_PASSWORD || 'yourpassword',
    database: process.env.DB_NAME || 'yourdatabase',
    waitForConnections: true,
    connectionLimit: 10,
    queueLimit: 0
});

// 导出 Promise 版本的连接池
module.exports = pool.promise();
